package io.renren.modules.jxgk.controller;

import io.renren.common.annotation.SysLog;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.common.utils.R;
import io.renren.modules.jxgk.entity.FeedbackInfoEntity;
import io.renren.modules.jxgk.service.FeedbackInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("FeedbackInfo/")
public class FeedbackInfoController {

    @Autowired
    FeedbackInfoService feedbackInfoService;

    @RequestMapping("Select")
    public R list(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<FeedbackInfoEntity> cse = feedbackInfoService.queryList(query);
        int total = feedbackInfoService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(cse, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }
    @RequestMapping("/Delete")
    public R delete(@RequestBody String[] indexs){
        feedbackInfoService.deleteBatch(indexs);
        return R.ok();
    }
    @RequestMapping("/Insert")
    public R save(@RequestBody FeedbackInfoEntity ste){
        feedbackInfoService.save(ste);
        return R.ok();
    }
    @RequestMapping("/Info/{index}")
    public R info(@PathVariable("index") String index){
        FeedbackInfoEntity cse = feedbackInfoService.queryObject(index);
        return R.ok().put("FeedbackInfo", cse);
    }
    @SysLog("修改用户")
    @RequestMapping("/Update")
    public R update(@RequestBody FeedbackInfoEntity cse){
        feedbackInfoService.update(cse);
        return R.ok();
    }
}